//
// Created by xili on 2024/8/6 11:09.
// Go big or go home.
//
#include <vector>
#include <iostream>

using namespace std;

class Solution {
public:
    long long findTheArrayConcVal(vector<int> &nums) {
        int n = nums.size();
        int left = 0, right = n - 1;
        long long ans = 0;
        while (left < right) {
            ans += merge(nums[left++], nums[right--]);
        }
        return left == right ? ans + nums[left] : ans;
    }

    long long merge(int x, int y) {
        return stoll(to_string(x) + to_string(y));
    }
};